package com.chao.yyks.modular.problem.controller;

import com.alibaba.fastjson.JSONObject;
import com.chao.common.util.log.Inter;
import com.chao.common.util.reaction.PageList;
import com.chao.yyks.modular.problem.bean.EnWordBank;
import com.chao.yyks.modular.problem.service.EnWordBankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
import java.util.List;


/**
 * 词汇信息Controller
 * chao
 * 2024-09-12
 */
@RestController
@RequestMapping("/enWordBank")
public class EnWordBankController {

	/**
	 * 词汇信息Service
	 */
	@Autowired
	private EnWordBankService enWordBankService;

	/**
	 * 批量新增词汇信息
	 */
	@Inter("EWB_ADD_02")
	@RequestMapping(method = RequestMethod.POST, value = "insertAllEnWordBank")
	public void insertAllEnWordBank(@RequestBody List<EnWordBank> enWordBankList){
		enWordBankService.insertAllEnWordBank(enWordBankList);
	}

	/**
	 * 物理删除词汇信息
	 */
	@Inter("EWB_DEL_02")
	@RequestMapping(method = RequestMethod.POST, value = "deleteDataEnWordBank")
	public void deleteDataEnWordBank(@RequestBody EnWordBank enWordBank){
		enWordBankService.deleteDataEnWordBank(enWordBank.getWordBank());
	}

	/**
	 * 查询词汇信息列表
	 */
	@Inter("EWB_SEL_02")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnWordBankByList")
	public PageList<EnWordBank> selectEnWordBankByList(@RequestParam Map<String,Object> map){
		return enWordBankService.selectEnWordBankByList(new JSONObject(map));
	}

}